<template>
  <div class="echarts" ref="echarts"></div>
</template>

<script>
import * as echarts from 'echarts'
import resize from '@/mixins/resize'
import {mapState} from 'vuex'
export default {
  name: 'BarChart',
  mounted() {
    this.myEcharts = echarts.init(this.$refs.echarts)
    this.myEcharts.setOption({
      xAxis: {
        type: 'category',
        boundaryGap: true
      },
      yAxis: {
        show: false
      },
      series: [
        {
          type: 'bar',
          smooth: true,
          color: ['#6295F9']
        }
      ],
      grid: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0
      }
    })
  },
  computed:{
    ...mapState({
      payTrend:state=>state.home.homeData.payTrend
    })
  },
  watch:{
    payTrend(val){
      this.myEcharts.setOption({
        series:{
          data:val
        }
      })
    }
  },
  mixins: [resize]
}
</script>

<style lang="scss">
.echarts {
  width: 100%;
  height: 50px;
}
</style>
